package com.atguigu.boot.utils;

import lombok.Data;

@Data
public class Result<T> {

    private String code;
    private String msg;
    private T data;

    public static Result success() {
        Result result = new Result<>();
        result.setCode("200");
        result.setMsg("成功");
        return result;
    }

    public static <T> Result success(T data) {
        Result result = new Result<>();
        result.setCode("200");
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static Result error() {
        Result result = new Result<>();
        result.setCode("500");
        result.setMsg("失败");
        return result;
    }
}
